package com.wangjiang.foundation.mybatis.convert;

import cn.hutool.core.bean.BeanUtil;
import net.sf.cglib.beans.BeanCopier;

import java.util.IllegalFormatException;

public interface ConvertFrom<E> {


    default <VO extends ConvertFrom<E>> VO convertFrom(E source) throws IllegalFormatException {
        if (source == null) {
            return null;
        }
        BeanCopier beanCopier = BeanCopier.create(source.getClass(), this.getClass(), false);
        beanCopier.copy(source, this, null);
        return (VO) this;
    }
}